﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace FCS.Test
{
    /// <summary>
    /// Summary description for BulkPerformTests
    /// </summary>
    [TestClass]
    public class BulkPerformTests : Functional
    {
        public BulkPerformTests()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        [TestMethod]
        public void PerformTest()
        {
            int s = 0;
            Perform(a => s += a, IntList(1, 10000));
            Assert.AreEqual(50005000, s);

            int s2 = 0;
            Perform(a => s2 += a, IntList(1, 1));
            Assert.AreEqual(1, s2);

            int s3 = 0;
            Perform(a => s3 += a, Empty<int>());
            Assert.AreEqual(0, s3);
        }

        [TestMethod]
        public void PersistTestTest()
        {
            Assert.AreEqual(10000, Length(Persist(IntList(1, 10000))));
        }
    }
}
